import { FormOptions, FormType } from '@/models/form'
import { RoleLevelOptions } from '@/constant/options'
// import Schema from 'async-validator'

export function initFormOptions(): FormOptions {
  return {
    title: '角色',
    dialogWidth: '400px',
    labelWidth: 'auto',
    showStatusIcon: true,
    formItems: [
      {
        label: '名称',
        key: 'name',
        formType: FormType.Input,
        value: '',
        placeholder: '请输入名称',
        rules: [
          { required: true, message: '请输入名称', trigger: 'blur' },
          { min: 5, max: 25, message: '长度在 5 到 25 个字符', trigger: 'blur' }
        ]
      },
      {
        label: '标识',
        key: 'code',
        formType: FormType.Input,
        value: '',
        placeholder: '请输入角色标识',
        rules: [
          { required: true, message: '请输入角色标识', trigger: 'blur' },
          { min: 2, max: 25, message: '长度在 2 到 10 个字符', trigger: 'blur' }
        ]
      },
      {
        label: '角色',
        key: 'level',
        formType: FormType.Select,
        value: '',
        options: RoleLevelOptions,
        placeholder: '请选择角色层级',
        customStyle: 'width: 100%',
        rules: [{ required: true, message: '请选择角色层级', trigger: 'blur' }]
      },
      {
        label: '描述',
        key: 'description',
        formType: FormType.Input,
        value: '',
        placeholder: '请输入描述信息',
        rules: [{ max: 200, message: '长度最大200', trigger: 'blur' }]
      }
    ]
  }
}
